package com.ewzj.bigdata.mvp.model.rspbean;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.util.List;

/**
 * author:zhangjing
 * 作用:
 * return:
 */

public class HomeBean implements MultiItemEntity, Parcelable {

    /**
     * id : 3
     * go_url : http://h5.15miwo.cn/ershoufang/3
     * groupId : 8
     * three_url : https://m.lianjia.com/cd/ershoufang/106100118473.html
     * house_type : ershoufang
     * thumb : http://image1.ljcdn.com/510100-inspection/898ca8f8-bb56-4925-8635-b89b62179af3.jpg.232x174.jpg
     * name : 南北通透+带前后花园+居家装修
     * layout : 3室2厅
     * area : 135.00㎡
     * house_orien : 南
     * house_name : 融城理想
     * house_tags : [{"tag_name":"满两年","color":"#FF8062"},{"tag_name":"随时看房","color":"#33BE85"}]
     * total_price : 245
     * price : 18148元/㎡
     * region : 高新.地铁口
     * address : 市一医院旁
     * rent_type :
     * sources : 链家
     * visit : 0
     * lon : 0.000000
     * lat : 0.000000
     * is_self : 0
     * is_collect : 0
     */

    private int id;
    private String go_url;
    private int groupId;
    private String three_url;
    private String house_type;
    private String thumb;
    private String name;
    private String region_id;
    private String layout;
    private String area;
    private String house_orien;
    private String house_name;
    private String total_price;
    private String price;
    private String map_level;
    private int sum;
    private String region;
    private String address;
    private String rent_type;
    private String sources;
    private String visit;
    private Double lon;
    private Double lat;
    private int is_self;
    private int is_collect;
    private String section;

    public String getRegion_id() {
        return region_id;
    }

    public void setRegion_id(String region_id) {
        this.region_id = region_id;
    }

    public String getMap_level() {
        return map_level;
    }

    public void setMap_level(String map_level) {
        this.map_level = map_level;
    }

    public Double getLon() {
        return lon;
    }

    public Double getLat() {
        return lat;
    }

    public void setLon(Double lon) {
        this.lon = lon;
    }

    public void setLat(Double lat) {
        this.lat = lat;
    }

    public HomeBean(String section) {
        this.section = section;
    }

    public String getSection() {
        return section;
    }

    public void setSection(String section) {
        this.section = section;
    }

    private List<HouseTagsEntity> house_tags;

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public String getGo_url() {
        return go_url;
    }

    public void setGo_url(String go_url) {
        this.go_url = go_url;
    }



    public String getThree_url() {
        return three_url;
    }

    public void setThree_url(String three_url) {
        this.three_url = three_url;
    }

    public String getHouse_type() {
        return house_type;
    }

    public void setHouse_type(String house_type) {
        this.house_type = house_type;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLayout() {
        return layout;
    }

    public void setLayout(String layout) {
        this.layout = layout;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getHouse_orien() {
        return house_orien;
    }

    public void setHouse_orien(String house_orien) {
        this.house_orien = house_orien;
    }

    public String getHouse_name() {
        return house_name;
    }

    public void setHouse_name(String house_name) {
        this.house_name = house_name;
    }

    public String getTotal_price() {
        return total_price;
    }

    public void setTotal_price(String total_price) {
        this.total_price = total_price;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getRent_type() {
        return rent_type;
    }

    public void setRent_type(String rent_type) {
        this.rent_type = rent_type;
    }

    public String getSources() {
        return sources;
    }

    public void setSources(String sources) {
        this.sources = sources;
    }

    public String getVisit() {
        return visit;
    }

    public void setVisit(String visit) {
        this.visit = visit;
    }


    public int getIs_self() {
        return is_self;
    }

    public void setIs_self(int is_self) {
        this.is_self = is_self;
    }

    public int getIs_collect() {
        return is_collect;
    }

    public void setIs_collect(int is_collect) {
        this.is_collect = is_collect;
    }

    public List<HouseTagsEntity> getHouse_tags() {
        return house_tags;
    }

    public void setHouse_tags(List<HouseTagsEntity> house_tags) {
        this.house_tags = house_tags;
    }

    public static class HouseTagsEntity implements Parcelable {
        /**
         * tag_name : 满两年
         * color : #FF8062
         */

        private String tag_name;
        private String color;

        public String getTag_name() {
            return tag_name;
        }

        public void setTag_name(String tag_name) {
            this.tag_name = tag_name;
        }

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.tag_name);
            dest.writeString(this.color);
        }

        public HouseTagsEntity() {
        }

        protected HouseTagsEntity(Parcel in) {
            this.tag_name = in.readString();
            this.color = in.readString();
        }

        public static final Creator<HouseTagsEntity> CREATOR = new Creator<HouseTagsEntity>() {
            @Override
            public HouseTagsEntity createFromParcel(Parcel source) {
                return new HouseTagsEntity(source);
            }

            @Override
            public HouseTagsEntity[] newArray(int size) {
                return new HouseTagsEntity[size];
            }
        };
    }

    @Override
    public int getItemType() {
        if (house_type==null){
            return 0;
        }else if (house_type.equals("xinfang")){
            return 1;
        }else if (house_type.equals("ershoufang")){
            return 2;
        }else if (house_type.equals("zufang")){
            return 3;
        }else {
            return 0;
        }
//        return 0;
    }

    public HomeBean() {
    }

    @Override
    public boolean equals(Object obj) {
        HomeBean s=(HomeBean)obj;
        boolean is=id==s.id && name.equals(s.name);
        return is;
    }

    @Override
    public int hashCode() {
        String in = id + name;
        return in.hashCode();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.go_url);
        dest.writeInt(this.groupId);
        dest.writeString(this.three_url);
        dest.writeString(this.house_type);
        dest.writeString(this.thumb);
        dest.writeString(this.name);
        dest.writeString(this.region_id);
        dest.writeString(this.layout);
        dest.writeString(this.area);
        dest.writeString(this.house_orien);
        dest.writeString(this.house_name);
        dest.writeString(this.total_price);
        dest.writeString(this.price);
        dest.writeString(this.map_level);
        dest.writeInt(this.sum);
        dest.writeString(this.region);
        dest.writeString(this.address);
        dest.writeString(this.rent_type);
        dest.writeString(this.sources);
        dest.writeString(this.visit);
        dest.writeValue(this.lon);
        dest.writeValue(this.lat);
        dest.writeInt(this.is_self);
        dest.writeInt(this.is_collect);
        dest.writeString(this.section);
        dest.writeTypedList(this.house_tags);
    }

    protected HomeBean(Parcel in) {
        this.id = in.readInt();
        this.go_url = in.readString();
        this.groupId = in.readInt();
        this.three_url = in.readString();
        this.house_type = in.readString();
        this.thumb = in.readString();
        this.name = in.readString();
        this.region_id = in.readString();
        this.layout = in.readString();
        this.area = in.readString();
        this.house_orien = in.readString();
        this.house_name = in.readString();
        this.total_price = in.readString();
        this.price = in.readString();
        this.map_level = in.readString();
        this.sum = in.readInt();
        this.region = in.readString();
        this.address = in.readString();
        this.rent_type = in.readString();
        this.sources = in.readString();
        this.visit = in.readString();
        this.lon = (Double) in.readValue(Double.class.getClassLoader());
        this.lat = (Double) in.readValue(Double.class.getClassLoader());
        this.is_self = in.readInt();
        this.is_collect = in.readInt();
        this.section = in.readString();
        this.house_tags = in.createTypedArrayList(HouseTagsEntity.CREATOR);
    }

    public static final Creator<HomeBean> CREATOR = new Creator<HomeBean>() {
        @Override
        public HomeBean createFromParcel(Parcel source) {
            return new HomeBean(source);
        }

        @Override
        public HomeBean[] newArray(int size) {
            return new HomeBean[size];
        }
    };
}
